package com.car.Test;

import com.car.dao.EmployeeDao;
import com.car.dao.impl.EmployeeDaoImpl;
import com.car.domain.Employee;
import org.junit.Test;

import java.util.List;

public class EmployeeDaoImplTest {
    private static final EmployeeDao employeeDao=new EmployeeDaoImpl();
    @Test
    public void add() throws Exception {
        Employee employee=new Employee();
        employee.setName("小张");
        employee.setAge(18);
        employee.setGender("男");
        employee.setWorkId("0101");
        employee.setSalary(20000.0);
        employeeDao.add(employee);
    }

    @Test
    public void delete() throws Exception {
        int delete=employeeDao.delete(1);
    }

    @Test
    public void update() throws Exception {
        Employee employee=employeeDao.queryById(1);
        employee.setName("Anna");
        employeeDao.update(employee);
    }

    @Test
    public void queryById() throws Exception {
        Employee employee=employeeDao.queryById(1);
        System.out.println(employee);
    }

    @Test
    public void queryAll() throws Exception {
        List<Employee> employees = employeeDao.queryAll();
        System.out.println(employees);
    }
}